Cornell ECE 5725 Final Project, 2023 Fall

Automatic Obstacle Avoidance and Remote Control Small Car


A Project By Han Meng, hm588| Ruyi Zhou, rz443| Zebang Liu, zl875


Demonstration Video


Introduction

Welcome to the project website dedicated to the Automatic Obstacle Avoidance and Remote Control Small Car. Our project is focused on developing a holistic solution for the small car, encompassing various functionalities. Firstly, our system enables users to remotely control the small car through a specially designed website. Secondly, the small car can seamlessly transition to autopilot mode, autonomously navigating and avoiding obstacles in its surroundings. Additionally, users have the capability to utilize the Pi Camera for remote environmental monitoring by controlling the micro servo connected to it. By integrating advanced technologies, such as the Raspberry Pi, Pi Camera, Micro Servo and Ultrasonic Sensors, our project aims to provide a cohesive and interactive experience, catering to both manual and autonomous control of the vehicle.


Project Objective


Design

The car will be operated remotely via a website, which will feature a real-time display of the car's front view and alert the user with a warning message if there is an obstacle detected in front of the car or to its left or right. The website will offer two modes of control: manual and autopilot. In manual mode, users can navigate the car in four directions using the website's buttons. Switching to autopilot mode is as simple as clicking the 'switch mode' button, after which the car autonomously drives straight ahead. Upon encountering an obstacle, the car will automatically turn 90 degrees to the right to avoid it, then proceed forward, continuously scanning for further obstacles. We are setting up a server on the Raspberry Pi 4 to manage the entire system. This involves establishing two communication channels: a HTTP server (using Python Flask) for streaming the camera's video feed to the website, and a websocket setting up connection channel for relaying control signals from the website's interface to the Raspberry Pi 4, which in turn manipulates the motors to steer the car. For the website frontend, we used Javascript React package with Ant Design for the UI development.

Basic Framework

Testing

Hardware: Within the hardware realm, our project is anchored by an assemblage of essential components. Notably, the ensemble features a potent Raspberry Pi 4, paired with two dynamic DC motors, a precision-driven servo motor, an ultrasonic sensor, and a sophisticated camera. A meticulous integration unfolds as the camera and ultrasonic sensor find residence atop the servo motor, demanding an unobstructed rotation angle for optimal functionality. Consequently, the wiring configuration assumes a pivotal role, necessitating strategic arrangement to prevent encumbrance to the motor's movement. Furthermore, the servo motor's torque capacity becomes paramount, tasked with deftly orchestrating the rotation of both the ultrasonic sensor and the camera. And also, the correct alignment of wires to their respective GPIO pins emerges as a critical choreography, ensuring seamless control bestowed upon the Raspberry Pi 4.

Outlook Pi Camera and Ultrasonic Sensors Back of the small car

Software: Navigating the digital landscape, our software endeavors commence with the synchronization of video data, ensuring its seamless transmission from the camera to the website. The website, a virtual arena for control and observation, must adeptly dispatch control signals to the Raspberry Pi 4, harmonizing with the real-time video feed from the camera. A paramount task is validating the functionality of the mode switch, affirming the small car's fluid transition between user-controlled and autopilot modes.

Website Interface

Co-Test: In the crucible of co-testing, the amalgamation of hardware and software culminates in the small car's ability to gracefully respond to user commands. Yet, the intricacies of DC motors introduce a nuance, potentially causing a disparity in angular velocities between the two wheels. This incongruity, while subtle, hinders the small car's quest for a perfectly straight trajectory. As the current prototype lacks a feedback routine for PID adjustment, a judicious approach intervenes. A minute elevation in the rotational speed of one motor acts as the corrective touch, orchestrating a harmonious alignment that enables the small car to traverse straight paths in both user-controlled and autopilot modes.


Result

Our rigorous testing and integration efforts have yielded a small car that seamlessly translates conceptual aspirations into tangible functionality. The hardware components, including the Raspberry Pi 4, DC motors, servo motor, ultrasonic sensor, and camera, have harmoniously converged into a cohesive system. The servo motor's capacity to rotate both the ultrasonic sensor and camera was successfully optimized, ensuring unimpeded movement and precise control. All wiring configurations were meticulously executed, facilitating effective communication between the hardware components and the Raspberry Pi 4.

On the software front, the synchronization of video data transmission from the camera to the website achieved flawless execution. The website's responsiveness in dispatching control signals to the Raspberry Pi 4 concurrently with the real-time video feed exemplifies the seamless marriage of hardware and software elements. The mode switch functionality was rigorously tested and validated, affirming the small car's adept transition between user-controlled and autopilot modes.

Through extensive co-testing, the small car demonstrated its agility and responsiveness to user commands. While the inherent nuances of DC motors introduced minor angular velocity differentials between wheels, our astute correction mechanism—increasing the rotational speed of one motor—proved effective. This adjustment, while compensatory, facilitated the small car's ability to traverse straight paths with elegance in both user-controlled and autopilot modes.


Future Work

1. PID Control Optimization: Include the PID control algorithm to enhance the precision and responsiveness of motor control. Fine-tune the parameters based on extensive testing and experimentation.

2. Computer Vision based Obstacle Detection Algorithm: Design and implement a real-time obstacle detection algorithm using computer vision techniques. This algorithm should analyze the live video feed from the RPi Camera to identify and classify obstacles in the car's environment.

3. Integration with Other IoT Devices: Explore possibilities for integrating the small car with other Internet of Things (IoT) devices. For example, connect the system to smart home platforms, residents can use our small car to take the delivery.

4. Upgrading the Outside Frame of the Small Car: Integrate LED indicators or aesthetic elements into the frame design for visual appeal and improved user interaction. In addition, consider materials such as lightweight metals, 3D-printed components for flexibility in design.

5. Adding More Sensors: Consider sensors such as infrared (IR) sensors, LIDAR, or additional cameras to provide a more comprehensive understanding of the surroundings.

6. Implementing Speed Control: Develop an adaptive speed control algorithm that considers the data from environmental sensors and obstacle detection systems. The small car can then dynamically adjust its speed based on the complexity of the environment or the presence of obstacles.


Work Distribution

Generic placeholder image
Han Meng

hm588@cornell.edu

Developing and fine-tuning the user interface of the dedicated website for remote control; Ensuring seamless communication between the user interface and the small car; Designing obstacle avoidance algorithm using ultrasonic sensors

Generic placeholder image
Ruyi Zhou

rz443@cornell.edu

Hardware integration, focusing on the incorporation of the Raspberry Pi, Pi Camera, Micro Servo, and Ultrasonic Sensors

Generic placeholder image
Zebang Liu

zl875@cornell.edu

Optimize the circuit design, address compatibility issues and ensure the overall performance of the small car



Parts List



References

[1] Raspberry Pi Documentation, "Camera - Raspberry Pi Documentation," Raspberry Pi.
[2] Adafruit, "Product 169 - Adafruit," Adafruit Industries.
[3] Adafruit, "4007_Web.pdf," Adafruit Industries
[4] "WebSockets Documentation," websockets.readthedocs.io.
[5] "React - A JavaScript library for building user interfaces," react.dev.
[6] "Ant Design - The world's second most popular React UI framework," ant.design.
[7] "Welcome to Flask," flask.palletsprojects.com.


Code Appendix

Github Repository